home *** CD-ROM | disk | FTP | other *** search
- Path: frco.com!usenet
- From: Jadam@tcmail.frco.com (Jim Adam)
- Newsgroups: comp.lang.c++
- Subject: Re: Help a newbie with a problem....
- Date: 6 Feb 1996 16:46:58 GMT
- Organization: Fisher Rosemount Systems
- Message-ID: <4f80m2$692@rolaids.frco.com>
- References: <311527bc.180318@news.deltanet.com>
- NNTP-Posting-Host: primrose.frco.com
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.11
-
- In article <311527bc.180318@news.deltanet.com>, kkhan@deltanet.com says...
-
- >Ok I have no clue as to what is wrong with this statement, I have
- >tried various forms with no success. The statement is supposed to give
- >me a factorial result with this formula : (n - r + 1) / r.
-
- [ snip ]
-
- > for ( int r = 1; r <= sel; r++)
- > {
- > combo = 1;
- > for ( int fact = ( (num - r + 1) / r ); fact <= r; fact++)
- > { combo *= fact; }
- >
- > }
- > cout << endl << "Odds of winning: 1 in " << combo;
- >}
-
- Shouldn't the "combo = 1" statement come *before* the first for() loop?
-
- Jim
- Jadam@tcmail.frco.com
-
-
-